home *** CD-ROM | disk | FTP | other *** search
/ PC-Blue - MS DOS Public Domain Library / PC-Blue MS-DOS Public Domain Library - NYACC.iso / vol285 / creatper.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1987-03-15  |  3.7 KB  |  120 lines

  1. 100  REM CREATPER Program
  2. 110  REM Creates (Formats) a Persons File
  3. 120  REM Copyright (c) 1983 - 1987 by: Melvin O. Duke.
  4. 130  DEFINT A-Z
  5. 600  REM Titles
  6. 610  TITLE$ = "Create a Persons File"
  7. 620  TITLE$ = TITLE$ + " ON DISPLAY"
  8. 700  REM Terminate if not called from the Menu
  9. 710  IF DD.MENU$ <> "" THEN 770
  10. 720  COLOR 7,0 : KEY ON : CLS : LOCATE 15,1
  11. 730  PRINT "Cannot run the"
  12. 740  PRINT TITLE$
  13. 750  PRINT "Program, unless selected from the MENU"
  14. 760  END
  15. 770  REM OK
  16. 1000  REM Produce the first screen
  17. 1010  KEY ON : CLS : KEY OFF
  18. 1020  REM Draw the outer double box
  19. 1030  R1 = 1 : C1 = 1 : R2 = 24 : C2 = 79 : GOSUB 1300
  20. 1040  REM Find the title location
  21. 1050  TITLE.POS = 40 - INT(LEN(TITLE$)/2)
  22. 1060  REM Draw the title box
  23. 1070  R1=3:C1=TITLE.POS-2:R2=6:C2=TITLE.POS+LEN(TITLE$)+1:GOSUB 1500
  24. 1080  REM Print the title
  25. 1090  LOCATE 4,TITLE.POS : PRINT TITLE$
  26. 1100  LOCATE 5,40-INT(LEN(VERSION$)/2) :  PRINT VERSION$;
  27. 1230  REM Draw the Copyright box
  28. 1240  R1 = 19 : C1 = 21 : R2 = 22 : C2 = 59 : GOSUB 1300
  29. 1250  REM Print the Copyright
  30. 1260  LOCATE 20,40-INT(LEN(COPY1$)/2) :  PRINT COPY1$;
  31. 1270  LOCATE 21,40-INT(LEN(COPY2$)/2) :  PRINT COPY2$;
  32. 1280  GOTO 1700
  33. 1300  REM subroutine to print a double box
  34. 1310  COLOR P
  35. 1320  FOR I = R1 + 1 TO R2 - 1
  36. 1330   LOCATE I, C1 : PRINT CHR$(186);
  37. 1340   LOCATE I, C2 : PRINT CHR$(186);
  38. 1350  NEXT I
  39. 1360   LOCATE R1, C1+1 : PRINT STRING$(C2-C1-1,205);
  40. 1390   LOCATE R2, C1+1 : PRINT STRING$(C2-C1-1,205);
  41. 1400   LOCATE R1, C1 : PRINT CHR$(201);
  42. 1410   LOCATE R1, C2 : PRINT CHR$(187);
  43. 1420   LOCATE R2, C1 : PRINT CHR$(200);
  44. 1430   LOCATE R2, C2 : PRINT CHR$(188);
  45. 1440  COLOR W
  46. 1450  RETURN
  47. 1500  REM subroutine to print a single box
  48. 1510  COLOR B
  49. 1520  FOR I = R1 + 1 TO R2 - 1
  50. 1530   LOCATE I, C1 : PRINT CHR$(179);
  51. 1540   LOCATE I, C2 : PRINT CHR$(179);
  52. 1550  NEXT I
  53. 1560   LOCATE R1, C1+1 : PRINT STRING$(C2-C1-1,196);
  54. 1590   LOCATE R2, C1+1 : PRINT STRING$(C2-C1-1,196);
  55. 1600   LOCATE R1, C1 : PRINT CHR$(218);
  56. 1610   LOCATE R1, C2 : PRINT CHR$(191);
  57. 1620   LOCATE R2, C1 : PRINT CHR$(192);
  58. 1630   LOCATE R2, C2 : PRINT CHR$(217);
  59. 1640  COLOR W
  60. 1650  RETURN
  61. 1700  REM ask user to press a key to continue
  62. 1710  LOCATE 25,1
  63. 1720  PRINT "Have Data Diskette(s) in Place, then Press any key to continue.";
  64. 1730  K$ = INKEY$ : IF K$ = "" THEN 1730
  65. 1740  KEY ON : CLS : KEY OFF
  66. 1800  REM Give the User one more chance to protect himself.
  67. 1810  LOCATE 10,1
  68. 1820  PRINT "This program FORMATS a Persons-file by writing new, empty records."
  69. 1830  PRINT "It will destroy any data which exists with the same record-numbers."
  70. 1840  PRINT
  71. 1850  PRINT "If this is REALLY what you want to do,"
  72. 1860  PRINT "type  y  to continue, and press the 'enter' key."
  73. 1870  PRINT "Otherwise, type anything else, and press the 'enter' key."
  74. 1880  PRINT
  75. 1890  LINE INPUT "Enter your desired action: ",REPLY$
  76. 1900  IF LEFT$(REPLY$,1) = "y" THEN 2000
  77. 1910  IF LEFT$(REPLY$,1) = "Y" THEN 2000
  78. 1920  PRINT
  79. 1930  PRINT "File was NOT Created."
  80. 1940  PRINT
  81. 1950  PRINT "Press any key to continue"
  82. 1960  A$ = INKEY$ : IF A$ = "" THEN 1960
  83. 1970  GOTO 2330  'to end the program
  84. 2000  REM CREATPER Program Starts Here
  85. 2010  OPEN DD.PERS$+"persfile" AS #1 LEN = 256
  86. 2020  FIELD 1,5ASF1$,20ASF2$,30ASF3$,2ASF4$,5ASF5$,5ASF6$,5ASF7$,11ASF8$,18ASF9$,16ASF10$,16ASF11$,11ASF12$,18ASF13$,16ASF14$,16ASF15$,11ASF16$,18ASF17$,16ASF18$,16ASF19$
  87. 2030  REM Write the Persons Records
  88. 2040  FOR I = OLD.MAX.PER + 1 TO MAX.PER
  89. 2050   TEMP! = -I
  90. 2060   TEMP$ = MKS$(TEMP!)
  91. 2070   LSET F1$ = TEMP$          'Record Number
  92. 2080   TEMP$ = " "
  93. 2090   TEMP! = 0
  94. 2100   LSET F2$ = TEMP$          'Surname
  95. 2110   LSET F3$ = TEMP$          'Given Names
  96. 2120   LSET F4$ = TEMP$          'Sex
  97. 2130   LSET F5$ = MKS$(TEMP!)    'Code
  98. 2140   LSET F6$ = MKS$(TEMP!)    'Father
  99. 2150   LSET F7$ = MKS$(TEMP!)    'Mother
  100. 2160   REM all the rest are string
  101. 2170   LSET F8$ = TEMP$          'Birth Date
  102. 2180   LSET F9$ = TEMP$          'Birth City
  103. 2190   LSET F10$ = TEMP$         'Birth County
  104. 2200   LSET F11$ = TEMP$         'Birth State
  105. 2210   LSET F12$ = TEMP$         'Death Date
  106. 2220   LSET F13$ = TEMP$         'Death City
  107. 2230   LSET F14$ = TEMP$         'Death County
  108. 2240   LSET F15$ = TEMP$         'Death State
  109. 2250   LSET F16$ = TEMP$         'Burial Date
  110. 2260   LSET F17$ = TEMP$         'Burial City
  111. 2270   LSET F18$ = TEMP$         'Burial County
  112. 2280   LSET F19$ = TEMP$         'Burial State
  113. 2290   LOCATE 23,1 : PRINT "Writing Record Number:";I
  114. 2300   PUT #1,I
  115. 2310  NEXT I
  116. 2320  CLOSE #1
  117. 2330  KEY ON : CLS : KEY OFF : LOCATE 21,1
  118. 2340  PRINT "End of Program"
  119. 2350  RUN DD.MENU$+"menu"
  120.